﻿<UserControl x:Class="PocketBook.Views.EditorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="300">
    <Grid>
        <Grid HorizontalAlignment="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="320" />
                <RowDefinition Height="100" />
            </Grid.RowDefinitions>

            <DockPanel Margin="0,8,0,3" >
                <Button DockPanel.Dock="Right" Margin="4,0,0,0" VerticalContentAlignment="Center" ToolTip="Settings" x:Name="Edit">
                    <Button.Style>
                        <Style TargetType="{x:Type Button}">
                            <Setter Property="Visibility" Value="Hidden" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Path=Design.IsCustomisable}" Value="True">
                                    <Setter Property="Visibility" Value="Visible" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                    <Image Source="../Assets/settings.png" Stretch="none" />
                </Button>
                <TextBlock Text="{Binding Design.DisplayName}" FontWeight="Bold" FontSize="14" />
            </DockPanel>

            <Border Grid.Row="1" x:Name="DesignSite" BorderBrush="#CCCCCC" BorderThickness="0,0,1,1" Background="White">
                <Viewbox Stretch="Uniform">
                    <ContentControl x:Name="Design" Width="{Binding SiteSize.Width}" Height="{Binding SiteSize.Height}" >
                    </ContentControl>
                </Viewbox>
            </Border>

            <!-- Reflection -->
            <Rectangle Grid.Row="2">
                <Rectangle.Effect>
                    <BlurEffect Radius="2" />
                </Rectangle.Effect>
                <Rectangle.Fill >
                    <VisualBrush Visual="{Binding ElementName=DesignSite}" Stretch="None" AlignmentY="Bottom" />
                </Rectangle.Fill>
                <Rectangle.LayoutTransform>
                    <ScaleTransform ScaleY="-1" />
                </Rectangle.LayoutTransform>
                <Rectangle.OpacityMask>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                        <GradientStop Offset="0" Color="#00000000" />
                        <GradientStop Offset="1" Color="#30000000" />
                    </LinearGradientBrush>
                </Rectangle.OpacityMask>
            </Rectangle>
        </Grid>

        <!-- Footer -->
        <TextBlock Text="{Binding Design.Description}" FontSize="11" Padding="4,12,4,4" Margin="0,365,0,0"
            MaxWidth="260" TextWrapping="Wrap" HorizontalAlignment="Center" />
    </Grid>
</UserControl>
